1 import os
2 import pickle
3
4 details_list=[]
5 l2=[]
6 G = []
7 def file_save():
8 NAME_PRO = details_list[0]
9 ADDRESS_PRO = details_list[1]
10 MOBILE_NO_PRO = details_list[2]
11 ROOM_NO_PRO = details_list[3]
12 PRICE_PRO = details_list[4]
13 f = open("hotel.dat", "ab")
14 a=save(NAME_PRO,ADDRESS_PRO,MOBILE_NO_PRO,ROOM_NO_PRO,PRICE_PRO)
15 pickle.dump(a,f,protocol=2)
16 f.close()
17 restart_program()
18
19
20 def restart_program():
21 python = sys.executable
22 os.execl(python, python, * sys.argv)
23
24
25
26
27
28
29 class save:
30 def __init__(self, NAME_PRO, ADDRESS_PRO, MOBILE_NO_PRO, ROOM_NO_PRO, PRICE_PRO):
31 self.name=NAME_PRO
32 self.address=ADDRESS_PRO
33 self.mobile_no=MOBILE_NO_PRO
34 self.room_no=ROOM_NO_PRO
35 self.price=PRICE_PRO
36 print(self.name,self.address,self.mobile_no,self.room_no,self.price)
37
38 import sys
39
40 try:
41 from Tkinter import *
42 except ImportError:
43 from tkinter import *
44
45 try:
46 import ttk
47 py3 = False
48 except ImportError:
49 import tkinter.ttk as ttk
50 py3 = True
51
52
53 class HOTEL_MANAGEMENT:
54 def __init__(self):
55 def gotinfo():
56 self.gettininfo = str(self.gather.get())
57 print("\n")
58 if self.gettininfo.isdigit() == True and len(self.gettininfo) != 0:
59 self.Text1.insert(INSERT, "Valid room number ""\n")
60 else :
61 self.Text1.insert(INSERT,"invalid room number""\n")
62
63 try:
64 n = 0
65 f2 = open("hotel.dat", "rb")
66 while True:
67 s = pickle.load(f2)
68 a = str(s.room_no)
69 if self.gettininfo == a:
70 n = 1
71 print("NAME-", "\t", "\t", s.name)
72 print("\n")
73 print("ADDRESS-", "\t", s.address)
74 print("\n")
75 print("MOBILE NO.-", " ", s.mobile_no)
76 print("\n")
77 print("TOTAL BILL IS $", s.price)
78 elif EOFError:
79 if n == 0:
80 print("NO GUEST IN ROOM ", self.gettininfo)
81 else:
82 n = 0
83 continue
84 except EOFError:
85 pass
86 f2.close()
87
88 root = Tk()
89 '''This class configures and populates the toplevel window.
90 top is the toplevel containing window.'''
91 _bgcolor = '#d9d9d9' # X11 color: 'gray85'
92 _fgcolor = '#000000' # X11 color: 'black'
93 _compcolor = '#d9d9d9' # X11 color: 'gray85'
94 _ana1color = '#d9d9d9' # X11 color: 'gray85'
95 _ana2color = '#d9d9d9' # X11 color: 'gray85'
96 font10 = "-family {Segoe UI} -size 17 -weight bold -slant " \
97 "roman -underline 0 -overstrike 0"
98 font11 = "-family {Segoe UI} -size 28 -weight bold -slant " \
99 "roman -underline 0 -overstrike 0"
100 font9 = "-family {Segoe UI} -size 23 -weight bold -slant roman" \
101 " -underline 0 -overstrike 0"
102
103 root.geometry("881x582+249+104")
104 root.title("Hotel Management System")
105 root.configure(background="#d9d9d9")
106
107
108
109 self.Frame1 = Frame(root)
110 self.Frame1.place(relx=0.02, rely=0.03, relheight=0.94, relwidth=0.94)
111 self.Frame1.configure(relief=GROOVE)
112 self.Frame1.configure(borderwidth="2")
113 self.Frame1.configure(relief=GROOVE)
114 self.Frame1.configure(background="#d9d9d9")
115 self.Frame1.configure(width=825)
116
117 self.Text1 = Text(self.Frame1)
118 self.Text1.place(relx=0.04, rely=0.46, relheight=0.48, relwidth=0.93)
119 self.Text1.configure(background="white")
120 self.Text1.configure(font="TkTextFont")
121 self.Text1.configure(foreground="black")
122 self.Text1.configure(highlightbackground="#d9d9d9")
123 self.Text1.configure(highlightcolor="black")
124 self.Text1.configure(insertbackground="black")
125 self.Text1.configure(selectbackground="#c4c4c4")
126 self.Text1.configure(selectforeground="black")
127 self.Text1.configure(width=764)
128 self.Text1.configure(wrap=WORD)
129
130
131
132 self.Label1 = Label(self.Frame1)
133 self.Label1.place(relx=0.12, rely=0.15, height=48, width=377)
134 self.Label1.configure(background="#d9d9d9")
135 self.Label1.configure(disabledforeground="#a3a3a3")
136 self.Label1.configure(font=font9)
137 self.Label1.configure(foreground="#000000")
138 self.Label1.configure(text='''ENTER THE ROOM NO. :''')
139
140 self.Entry1 = Entry(self.Frame1)
141 self.gather=StringVar()
142 self.Entry1.place(relx=0.65, rely=0.17,height=40, relwidth=0.1)
143 self.Entry1.configure(background="white")
144 self.Entry1.configure(disabledforeground="#a3a3a3")
145 self.Entry1.configure(font="TkFixedFont")
146 self.Entry1.configure(foreground="#000000")
147 self.Entry1.configure(insertbackground="black")
148 self.Entry1.configure(width=84)
149 self.Entry1.configure(textvariable=self.gather)
150
151 self.Button1 = Button(self.Frame1)
152 self.Button1.place(relx=0.39, rely=0.29, height=74, width=197)
153 self.Button1.configure(activebackground="#d9d9d9")
154 self.Button1.configure(activeforeground="#000000")
155 self.Button1.configure(background="#d9d9d9")
156 self.Button1.configure(disabledforeground="#a3a3a3")
157 self.Button1.configure(font=font10)
158 self.Button1.configure(foreground="#000000")
159 self.Button1.configure(highlightbackground="#d9d9d9")
160 self.Button1.configure(highlightcolor="black")
161 self.Button1.configure(pady="0")
162 self.Button1.configure(text='''SUBMIT''')
163 self.Button1.configure(width=197)
164 self.Button1.configure(command=gotinfo)
165
166 self.Message1 = Message(self.Frame1)
167 self.Message1.place(relx=0.22, rely=0.02, relheight=0.12, relwidth=0.56)
168 self.Message1.configure(background="#d9d9d9")
169 self.Message1.configure(font=font11)
170 self.Message1.configure(foreground="#000000")
171 self.Message1.configure(highlightbackground="#d9d9d9")
172 self.Message1.configure(highlightcolor="black")
173 self.Message1.configure(text='''GET INFO HERE ..!!''')
174 self.Message1.configure(width=460)
175 root.mainloop()
176
177
178
179
180
181
182 if __name__ == '__main__':
183 GETINFO=HOTEL_MANAGEMENT()